import Vue from 'vue'
import store from './store'
import App from './App'



import { http } from '@/api/service.js' // 全局挂载引入，配置相关在该index.js文件里修改

Vue.prototype.$http = http
Vue.config.productionTip = false

const msg = (title, duration=1500, mask=false, icon='none')=>{
	//统一提示方便全局修改
	if(Boolean(title) === false){
		return;
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}



const prePage = ()=>{
	let pages = getCurrentPages();
	let prePage = pages[pages.length - 2];
	// #ifdef H5
	return prePage;
	// #endif
	return prePage.$vm;
}


Vue.prototype.$fire = new Vue();
Vue.prototype.$store = store;
Vue.prototype.$api = {msg, prePage};
//Vue.prototype.$apihost = 'http://www.slsyy.cn'//发行选择;
//Vue.prototype.$apihost = 'http://localhost'//本地测试;

App.mpType = 'app'
// 把 store 对象提供给 “store” 选项，这可以把 store 的实例注入所有的子组件
const app = new Vue({
	store,
    ...App
})
app.$mount()